package StringClock;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.Icon;


public class ClockIcon implements Icon {

	private int height;
	private int width;
	
	private Clock clock;

	// private Calendar gc;

	public ClockIcon(int height, int width, Clock clock){
		this.height = height;
		this.width = width;
		
		this.clock = clock;
		
		// this.gc = new GregorianCalendar();
	}

	@Override
	public int getIconHeight() {
		return this.height;
	}

	@Override
	public int getIconWidth() {
		return this.width;
	}

	@Override
	public void paintIcon(Component c, Graphics g, int x, int y) {
		Calendar gc = new GregorianCalendar();
		Graphics2D g2d = (Graphics2D) g;
		g2d.drawString(gc.get(Calendar.HOUR) + ":" + gc.get(Calendar.MINUTE) + ":" + gc.get(Calendar.SECOND), width/2, height/2);
//		clock.update();
	}

}
